#include "Tooth.h"
#include "GameUtil.h"

using namespace cocos2d;

Tooth::Tooth(void)
{

}


Tooth::~Tooth(void)
{
}

bool Tooth::init(void) {
	if (!Creature::init()) {  
        return false;  
    }

	// init
	d_objType = OBJ_TYPE_TOOTH;
	d_state = STATE_DEAD;
	d_creatureSprite = CCSprite::create();

	// bullet
	d_bulletSpeed = 100;
	d_bulletDamage = 10;
	d_bulletType = BULLET_TYPE_1;
	d_shootInterval = 100;
	
	// hp
	d_baseHP = 100;
	d_maxHP = d_baseHP * GameUtil::instance()->getSetting()->getHealthBuff();
	d_hasHpBar = true;

	d_animInterval = 5.0;
	d_hpRecoveryRate = 1.0;

    return true;  
}

void Tooth::shoot()
{
	// shoot
}

void Tooth::onDead()
{
	GameUtil::instance()->getToothManager()->removeTooth(this);
	GameUtil::instance()->gameover();
}

float Tooth::onHit(float damage)
{
	GameUtil::instance()->getWaveManager()->hitted(damage);
	return damage;
}

void Tooth::onUpdrade()
{
	d_maxHP = d_baseHP * GameUtil::instance()->getSetting()->getHealthBuff();
}